<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商城服务 - 智慧后勤综合管理系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #e0f7fa, #bbdefb, #90caf9);
            color: #333;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        header {
            background: rgba(255, 255, 255, 0.9);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            padding: 15px 0;
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .navbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .logo i {
            font-size: 28px;
            color: #2563eb;
        }

        .logo h1 {
            font-size: 24px;
            color: #2563eb;
            font-weight: 700;
        }

        .nav-links {
            display: flex;
            gap: 25px;
        }

        .nav-links a {
            text-decoration: none;
            color: #333;
            font-weight: 500;
            padding: 8px 12px;
            border-radius: 6px;
            transition: all 0.3s ease;
        }

        .nav-links a:hover, .nav-links a.active {
            background: #2563eb;
            color: white;
        }

        .nav-links .active {
            background: #2563eb;
            color: white;
        }

        .user-actions {
            display: flex;
            gap: 15px;
            align-items: center;
        }

        .user-actions button {
            padding: 8px 16px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .login-btn {
            background: #2563eb;
            color: white;
        }

        .register-btn {
            background: #f0f7ff;
            color: #2563eb;
            border: 1px solid #2563eb !important;
        }

        .user-actions button:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

        /* 用户信息展示区域 */
        .user-info {
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            padding: 6px 12px;
            border-radius: 8px;
            transition: all 0.3s ease;
        }

        .user-info:hover {
            background: rgba(37, 99, 235, 0.1);
        }

        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: #eff6ff;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #2563eb;
            font-size: 18px;
        }

        .user-name {
            font-weight: 500;
            color: #333;
            max-width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .page-title {
            color: #2563eb;
            margin-bottom: 25px;
            padding-bottom: 15px;
            border-bottom: 2px solid #eef6ff;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .page-title i {
            font-size: 28px;
        }

        /* 商城服务样式 */
        .mall-categories {
            display: flex;
            gap: 15px;
            margin-bottom: 30px;
            overflow-x: auto;
            padding-bottom: 10px;
        }

        .category-btn {
            padding: 12px 20px;
            background: #f1f5f9;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 500;
            white-space: nowrap;
            transition: all 0.3s ease;
        }

        .category-btn.active, .category-btn:hover {
            background: #2563eb;
            color: white;
        }

        .products-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 25px;
        }

        .product-card {
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
            border: 1px solid #e2e8f0;
        }

        .product-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }

        .product-image {
            height: 180px;
            background: #f1f5f9;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .product-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .product-card:hover .product-image img {
            transform: scale(1.05);
        }

        .product-info {
            padding: 20px;
        }

        .product-title {
            font-weight: 600;
            margin-bottom: 8px;
            color: #1e293b;
        }

        .product-desc {
            color: #64748b;
            font-size: 14px;
            margin-bottom: 15px;
            line-height: 1.5;
        }

        .product-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .product-price {
            font-weight: 700;
            color: #2563eb;
        }

        .add-to-cart {
            background: #eff6ff;
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: #2563eb;
            transition: all 0.3s ease;
        }

        .add-to-cart:hover {
            background: #2563eb;
            color: white;
        }

        /* 购物车图标样式 */
        .cart-icon {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: #2563eb;
            color: white;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            z-index: 99;
            transition: all 0.3s ease;
        }

        .cart-icon:hover {
            transform: scale(1.1);
        }

        .cart-count {
            position: absolute;
            top: -5px;
            right: -5px;
            background: #ef4444;
            color: white;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            font-size: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* 购物车弹窗样式 */
        .cart-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: none;
            justify-content: flex-end;
            align-items: flex-start;
            z-index: 100;
            padding-top: 80px;
        }

        .cart-content {
            background: white;
            width: 400px;
            max-width: 90%;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            max-height: 80vh;
            display: flex;
            flex-direction: column;
        }

        .cart-header {
            padding: 15px 20px;
            background: #2563eb;
            color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .cart-header h3 {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 18px;
        }

        .close-cart {
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            padding: 0 5px;
        }

        .cart-body {
            padding: 20px;
            overflow-y: auto;
            flex-grow: 1;
        }

        .empty-cart {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 40px 0;
            color: #64748b;
        }

        .empty-cart i {
            font-size: 50px;
            margin-bottom: 15px;
        }

        .cart-item {
            display: flex;
            gap: 15px;
            padding: 15px 0;
            border-bottom: 1px solid #e2e8f0;
        }

        .cart-item:last-child {
            border-bottom: none;
        }

        .cart-item-image {
            width: 80px;
            height: 80px;
            border-radius: 8px;
            overflow: hidden;
            flex-shrink: 0;
        }

        .cart-item-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .cart-item-details {
            flex-grow: 1;
        }

        .cart-item-title {
            font-weight: 600;
            margin-bottom: 5px;
            color: #1e293b;
        }

        .cart-item-price {
            color: #2563eb;
            font-weight: 600;
            margin-bottom: 10px;
        }

        .cart-item-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .quantity-btn {
            width: 25px;
            height: 25px;
            border-radius: 50%;
            border: 1px solid #cbd5e1;
            background: white;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .quantity-btn:hover {
            background: #2563eb;
            color: white;
            border-color: #2563eb;
        }

        .quantity-input {
            width: 40px;
            text-align: center;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
            padding: 2px;
        }

        .remove-item {
            margin-left: auto;
            color: #ef4444;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 16px;
        }

        .cart-footer {
            padding: 15px 20px;
            border-top: 1px solid #e2e8f0;
        }

        .cart-total {
            display: flex;
            justify-content: space-between;
            margin-bottom: 15px;
            font-size: 18px;
            font-weight: 600;
        }

        .checkout-btn {
            width: 100%;
            padding: 12px;
            background: #2563eb;
            color: white;
            border: none;
            border-radius: 6px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .checkout-btn:hover {
            background: #1d4ed8;
        }

        footer {
            background: rgba(0, 0, 0, 0.7);
            color: white;
            text-align: center;
            padding: 20px;
            margin-top: auto;
        }

        .footer-content {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .copyright {
            font-size: 14px;
        }

        .footer-links {
            display: flex;
            gap: 20px;
        }

        .footer-links a {
            color: #ddd;
            text-decoration: none;
            transition: color 0.3s ease;
        }

        .footer-links a:hover {
            color: white;
        }

        /* 提示消息样式 */
        .toast-message {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 12px 24px;
            border-radius: 4px;
            z-index: 1000;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .toast-message.show {
            opacity: 1;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .navbar {
                flex-direction: column;
                gap: 15px;
            }

            .nav-links {
                flex-wrap: wrap;
                justify-content: center;
            }

            .footer-content {
                flex-direction: column;
                gap: 15px;
            }

            .user-info {
                max-width: 150px;
            }
        }

        @media (max-width: 480px) {
            .user-info {
                max-width: 100px;
            }

            .user-name {
                font-size: 14px;
            }

            .cart-content {
                width: 100%;
                max-width: 100%;
                height: 100%;
                max-height: 100%;
                border-radius: 0;
            }

            .cart-modal {
                padding-top: 0;
            }
        }
    </style>
</head>
<body>
<!-- 顶部导航栏 -->
<header>
    <div class="container">
        <nav class="navbar">
            <div class="logo">
                <i class="fas fa-cogs"></i>
                <h1>智慧后勤综合管理系统</h1>
            </div>
            <div class="nav-links">
                <a href="home.html">首页</a>
                <a href="mall.html" class="active">商城服务</a>
                <a href="search.html">搜索服务</a>
                <a href="profile.html">个人信息</a>
            </div>
            <div class="user-actions">
                <div class="user-info" id="user-info" onclick="window.location.href='profile.html'">
                    <div class="user-avatar">
                        <i class="fas fa-user"></i>
                    </div>
                    <div class="user-name" id="display-name">张明</div>
                </div>
            </div>
        </nav>
    </div>
</header>

<!-- 主内容区域 -->
<div class="container">
    <!-- 商城服务页面 -->
    <div>
        <div class="page-title">
            <i class="fas fa-shopping-cart"></i>
            <h2>商城服务</h2>
        </div>

        <div class="mall-categories">
            <button class="category-btn active" onclick="showCategory('takeaway')">外卖预定</button>
            <button class="category-btn" onclick="showCategory('daily-food')">每日菜品</button>
            <button class="category-btn" onclick="showCategory('greening')">绿化基地</button>
            <button class="category-btn" onclick="showCategory('medical')">医疗服务</button>
            <button class="category-btn" onclick="showCategory('group-buy')">团购活动</button>
            <button class="category-btn" onclick="showCategory('office')">办公用品</button>
            <button class="category-btn" onclick="showCategory('fresh-food')">生鲜水果</button>
            <button class="category-btn" onclick="showCategory('daily-supplies')">生活用品</button>
        </div>

        <!-- 外卖预定 -->
        <div id="takeaway" class="category-content" style="display: block;">
            <div class="products-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/chinese-food-take-out-box-with-chopsticks_23-2147863205.jpg" alt="精品商务套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">精品商务套餐</h3>
                        <p class="product-desc">三荤一素营养搭配，免费配送，30分钟送达</p>
                        <div class="product-footer">
                            <div class="product-price">¥28.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/delicious-vietnamese-food-including-pho-ga-noodles-spring-rolls-white-table_181624-34062.jpg" alt="健康轻食套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">健康轻食套餐</h3>
                        <p class="product-desc">低卡路里轻食，适合健身人士，45分钟送达</p>
                        <div class="product-footer">
                            <div class="product-price">¥35.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/top-view-table-full-delicious-food-composition_23-2149141352.jpg" alt="豪华双人套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">豪华双人套餐</h3>
                        <p class="product-desc">四荤两素，含汤品和甜点，适合商务宴请</p>
                        <div class="product-footer">
                            <div class="product-price">¥128.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 每日菜品 -->
        <div id="daily-food" class="category-content" style="display: none;">
            <div class="products-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/top-view-table-full-delicious-food-composition_23-2149141353.jpg" alt="今日特供A套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">今日特供A套餐</h3>
                        <p class="product-desc">红烧排骨+清炒时蔬+紫菜蛋汤+米饭</p>
                        <div class="product-footer">
                            <div class="product-price">¥25.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/flat-lay-table-full-delicious-food_23-2149141327.jpg" alt="今日特供B套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">今日特供B套餐</h3>
                        <p class="product-desc">宫保鸡丁+蒜蓉西兰花+番茄蛋汤+米饭</p>
                        <div class="product-footer">
                            <div class="product-price">¥22.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/flat-lay-table-full-delicious-food_23-2149141328.jpg" alt="素食套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">素食套餐</h3>
                        <p class="product-desc">麻婆豆腐+清炒时蔬+菌菇汤+米饭</p>
                        <div class="product-footer">
                            <div class="product-price">¥20.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 绿化基地 -->
        <div id="greening" class="category-content" style="display: none;">
            <div class="products-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/green-plants-office_23-2148216787.jpg" alt="办公室绿植套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">办公室绿植套餐</h3>
                        <p class="product-desc">5种净化空气植物组合，含花盆和养护手册</p>
                        <div class="product-footer">
                            <div class="product-price">¥168.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/beautiful-green-tree-pot_23-2148394999.jpg" alt="大型观叶植物">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">大型观叶植物</h3>
                        <p class="product-desc">1.5米高幸福树，办公室装饰首选</p>
                        <div class="product-footer">
                            <div class="product-price">¥288.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/small-cactus-pot-table_23-2148236843.jpg" alt="多肉植物组合">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">多肉植物组合</h3>
                        <p class="product-desc">8种多肉植物创意组合，适合桌面摆放</p>
                        <div class="product-footer">
                            <div class="product-price">¥88.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 医疗服务 -->
        <div id="medical" class="category-content" style="display: none;">
            <div class="products-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/medical-stethoscope-with-paperwork_23-2149307631.jpg" alt="年度体检套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">年度体检套餐</h3>
                        <p class="product-desc">基础体检项目+专业报告解读+健康建议</p>
                        <div class="product-footer">
                            <div class="product-price">¥580.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/doctor-with-stethoscope-hands-hospital-background_23-2149190048.jpg" alt="专家门诊预约">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">专家门诊预约</h3>
                        <p class="product-desc">三甲医院专家号预约服务，免排队</p>
                        <div class="product-footer">
                            <div class="product-price">¥200.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/medicine-capsules-global-health-with-geometric-patterns-generative-ai_188544-19633.jpg" alt="家庭常备药箱">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">家庭常备药箱</h3>
                        <p class="product-desc">20种常用药品组合，含使用说明书</p>
                        <div class="product-footer">
                            <div class="product-price">¥150.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 团购活动 -->
        <div id="group-buy" class="category-content" style="display: none;">
            <div class="products-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/group-people-holding-hands-together_53876-16093.jpg" alt="团队建设活动">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">团队建设活动</h3>
                        <p class="product-desc">20人团队拓展训练，含专业教练和保险</p>
                        <div class="product-footer">
                            <div class="product-price">¥2888.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/friends-eating-together_23-2148883760.jpg" alt="公司聚餐套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">公司聚餐套餐</h3>
                        <p class="product-desc">10人豪华宴席，含酒水和场地布置</p>
                        <div class="product-footer">
                            <div class="product-price">¥1588.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/group-young-people-having-fun-concert_23-2149151801.jpg" alt="KTV欢唱套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">KTV欢唱套餐</h3>
                        <p class="product-desc">10人3小时欢唱，含果盘和饮料</p>
                        <div class="product-footer">
                            <div class="product-price">¥688.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 办公用品 -->
        <div id="office" class="category-content" style="display: none;">
            <div class="products-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/office-desk-with-laptop-notebook-supplies_23-2148216759.jpg" alt="办公文具套装">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">办公文具套装</h3>
                        <p class="product-desc">10件套高品质办公文具，提升工作效率</p>
                        <div class="product-footer">
                            <div class="product-price">¥98.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/black-office-chair_23-2148216783.jpg" alt="人体工学椅">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">人体工学椅</h3>
                        <p class="product-desc">可调节高度和靠背，缓解久坐疲劳</p>
                        <div class="product-footer">
                            <div class="product-price">¥899.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/desk-with-laptop-office-supplies_23-2148216771.jpg" alt="桌面收纳套装">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">桌面收纳套装</h3>
                        <p class="product-desc">5件套桌面整理工具，保持办公桌整洁</p>
                        <div class="product-footer">
                            <div class="product-price">¥68.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 生鲜水果 -->
        <div id="fresh-food" class="category-content" style="display: none;">
            <div class="products-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/fresh-fruits-vegetables_23-2147893972.jpg" alt="新鲜水果礼盒">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">新鲜水果礼盒</h3>
                        <p class="product-desc">精选当季水果，8种搭配，办公室分享装</p>
                        <div class="product-footer">
                            <div class="product-price">¥68.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/fresh-organic-vegetables_23-2147893973.jpg" alt="有机蔬菜套餐">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">有机蔬菜套餐</h3>
                        <p class="product-desc">5种当季有机蔬菜，每周配送一次</p>
                        <div class="product-footer">
                            <div class="product-price">¥58.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/fresh-meat-seafood_23-2147893974.jpg" alt="精选肉类礼盒">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">精选肉类礼盒</h3>
                        <p class="product-desc">优质牛肉、猪肉和鸡肉组合，真空包装</p>
                        <div class="product-footer">
                            <div class="product-price">¥188.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 生活用品 -->
        <div id="daily-supplies" class="category-content" style="display: none;">
            <div class="products-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/cleaning-supplies-cart_23-2148883763.jpg" alt="家庭清洁套装">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">家庭清洁套装</h3>
                        <p class="product-desc">5种常用清洁剂+工具，一站式解决家务问题</p>
                        <div class="product-footer">
                            <div class="product-price">¥88.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/bathroom-accessories_23-2148883764.jpg" alt="卫浴用品套装">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">卫浴用品套装</h3>
                        <p class="product-desc">毛巾、浴巾、洗漱用品6件套</p>
                        <div class="product-footer">
                            <div class="product-price">¥128.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="product-card">
                    <div class="product-image">
                        <img src="https://img.freepik.com/free-photo/kitchen-utensils_23-2148883765.jpg" alt="厨房用具套装">
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">厨房用具套装</h3>
                        <p class="product-desc">8件常用厨房工具，不锈钢材质</p>
                        <div class="product-footer">
                            <div class="product-price">¥158.00</div>
                            <button class="add-to-cart">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 购物车弹窗 -->
<div class="cart-modal" id="cart-modal">
    <div class="cart-content">
        <div class="cart-header">
            <h3><i class="fas fa-shopping-cart"></i> 我的购物车</h3>
            <button class="close-cart" id="close-cart">&times;</button>
        </div>
        <div class="cart-body" id="cart-body">
            <!-- 购物车商品将在这里动态加载 -->
            <div class="empty-cart">
                <i class="fas fa-shopping-basket"></i>
                <p>购物车是空的</p>
            </div>
        </div>
        <div class="cart-footer">
            <div class="cart-total">
                <span>总计：</span>
                <span class="total-price">¥0.00</span>
            </div>
            <button class="checkout-btn">去结算</button>
        </div>
    </div>
</div>

<!-- 购物车图标 -->
<div class="cart-icon" id="cart-icon">
    <i class="fas fa-shopping-cart"></i>
    <span class="cart-count">0</span>
</div>

<!-- 底部信息 -->
<footer>
    <div class="footer-content">
        <div class="copyright">
            &copy; 2023 智慧后勤综合管理系统 | 企业后勤服务解决方案
        </div>
        <div class="footer-links">
            <a href="#">关于我们</a>
            <a href="#">服务条款</a>
            <a href="#">隐私政策</a>
            <a href="#">帮助中心</a>
            <a href="#">联系我们</a>
        </div>
    </div>
</footer>

<script>
    // 购物车数据
    let cart = [];

    // 页面加载时初始化
    document.addEventListener('DOMContentLoaded', function() {
        // 检查用户登录状态
        const username = localStorage.getItem('currentUser');
        if (username) {
            document.getElementById('display-name').textContent = username;
        } else {
            // 如果未登录，跳转到登录页面
            window.location.href = 'login.html';
        }

        // 加载购物车数据
        loadCart();

        // 为分类按钮添加事件
        document.querySelectorAll('.category-btn').forEach(btn => {
            btn.addEventListener('click', function() {
                document.querySelectorAll('.category-btn').forEach(b => {
                    b.classList.remove('active');
                });
                this.classList.add('active');
            });
        });

        // 为所有"加入购物车"按钮添加事件
        document.querySelectorAll('.add-to-cart').forEach(button => {
            button.addEventListener('click', function() {
                const productCard = this.closest('.product-card');
                addToCart(productCard);
            });
        });

        // 购物车图标点击事件
        document.getElementById('cart-icon').addEventListener('click', openCart);

        // 关闭购物车事件
        document.getElementById('close-cart').addEventListener('click', closeCart);

        // 点击模态框外部关闭购物车
        document.getElementById('cart-modal').addEventListener('click', function(e) {
            if (e.target === this) {
                closeCart();
            }
        });

        // 结算按钮点击事件
        document.querySelector('.checkout-btn').addEventListener('click', function() {
            if (cart.length === 0) {
                showToast('购物车是空的，请先添加商品');
            } else {
                showToast('结算功能即将上线，请稍后再试');
            }
        });
    });

    // 显示选中的分类内容
    function showCategory(categoryId) {
        // 隐藏所有分类内容
        document.querySelectorAll('.category-content').forEach(content => {
            content.style.display = 'none';
        });

        // 显示选中的分类内容
        document.getElementById(categoryId).style.display = 'block';
    }

    // 添加商品到购物车
    function addToCart(productCard) {
        const productInfo = {
            id: generateProductId(productCard),
            title: productCard.querySelector('.product-title').textContent,
            desc: productCard.querySelector('.product-desc').textContent,
            price: parseFloat(productCard.querySelector('.product-price').textContent.replace('¥', '')),
            image: productCard.querySelector('.product-image img').src,
            quantity: 1
        };

        // 检查商品是否已在购物车中
        const existingItem = cart.find(item => item.id === productInfo.id);

        if (existingItem) {
            existingItem.quantity += 1;
        } else {
            cart.push(productInfo);
        }

        // 保存购物车数据
        saveCart();

        // 更新购物车显示
        updateCartUI();

        // 显示添加成功的提示
        showToast(`${productInfo.title} 已添加到购物车`);
    }

    // 生成商品ID
    function generateProductId(productCard) {
        const title = productCard.querySelector('.product-title').textContent;
        return title.replace(/\s+/g, '-').toLowerCase();
    }

    // 保存购物车数据到localStorage
    function saveCart() {
        localStorage.setItem('cart', JSON.stringify(cart));
    }

    // 从localStorage加载购物车数据
    function loadCart() {
        const savedCart = localStorage.getItem('cart');
        if (savedCart) {
            cart = JSON.parse(savedCart);
            updateCartUI();
        }
    }

    // 更新购物车UI
    function updateCartUI() {
        const cartBody = document.getElementById('cart-body');
        const cartCount = document.querySelector('.cart-count');
        const totalPriceElement = document.querySelector('.total-price');

        // 更新购物车数量
        const totalItems = cart.reduce((total, item) => total + item.quantity, 0);
        cartCount.textContent = totalItems;

        // 计算总价
        const totalPrice = cart.reduce((total, item) => total + (item.price * item.quantity), 0);
        totalPriceElement.textContent = `¥${totalPrice.toFixed(2)}`;

        // 如果购物车为空，显示空购物车消息
        if (cart.length === 0) {
            cartBody.innerHTML = `
                <div class="empty-cart">
                    <i class="fas fa-shopping-basket"></i>
                    <p>购物车是空的</p>
                </div>
            `;
            return;
        }

        // 否则，渲染购物车商品
        cartBody.innerHTML = cart.map(item => `
            <div class="cart-item" data-id="${item.id}">
                <div class="cart-item-image">
                    <img src="${item.image}" alt="${item.title}">
                </div>
                <div class="cart-item-details">
                    <h4 class="cart-item-title">${item.title}</h4>
                    <div class="cart-item-price">¥${item.price.toFixed(2)}</div>
                    <div class="cart-item-actions">
                        <button class="quantity-btn minus">-</button>
                        <input type="number" class="quantity-input" value="${item.quantity}" min="1">
                        <button class="quantity-btn plus">+</button>
                        <button class="remove-item"><i class="fas fa-trash"></i></button>
                    </div>
                </div>
            </div>
        `).join('');

        // 为数量按钮添加事件
        document.querySelectorAll('.quantity-btn.minus').forEach(btn => {
            btn.addEventListener('click', function() {
                const itemId = this.closest('.cart-item').dataset.id;
                updateQuantity(itemId, -1);
            });
        });

        document.querySelectorAll('.quantity-btn.plus').forEach(btn => {
            btn.addEventListener('click', function() {
                const itemId = this.closest('.cart-item').dataset.id;
                updateQuantity(itemId, 1);
            });
        });

        // 为数量输入框添加事件
        document.querySelectorAll('.quantity-input').forEach(input => {
            input.addEventListener('change', function() {
                const itemId = this.closest('.cart-item').dataset.id;
                const newQuantity = parseInt(this.value);

                if (newQuantity < 1) {
                    this.value = 1;
                    return;
                }

                const item = cart.find(item => item.id === itemId);
                if (item) {
                    item.quantity = newQuantity;
                    saveCart();
                    updateCartUI();
                }
            });
        });

        // 为删除按钮添加事件
        document.querySelectorAll('.remove-item').forEach(btn => {
            btn.addEventListener('click', function() {
                const itemId = this.closest('.cart-item').dataset.id;
                removeFromCart(itemId);
            });
        });
    }

    // 更新商品数量
    function updateQuantity(itemId, change) {
        const item = cart.find(item => item.id === itemId);
        if (item) {
            item.quantity += change;

            // 确保数量不小于1
            if (item.quantity < 1) {
                item.quantity = 1;
            }

            saveCart();
            updateCartUI();
        }
    }

    // 从购物车移除商品
    function removeFromCart(itemId) {
        cart = cart.filter(item => item.id !== itemId);
        saveCart();
        updateCartUI();

        // 如果购物车为空，显示空购物车消息
        if (cart.length === 0) {
            closeCart();
        }

        showToast('商品已从购物车移除');
    }

    // 打开购物车
    function openCart() {
        document.getElementById('cart-modal').style.display = 'flex';
        document.body.style.overflow = 'hidden';
    }

    // 关闭购物车
    function closeCart() {
        document.getElementById('cart-modal').style.display = 'none';
        document.body.style.overflow = 'auto';
    }

    // 显示提示消息
    function showToast(message) {
        const toast = document.createElement('div');
        toast.className = 'toast-message';
        toast.textContent = message;
        document.body.appendChild(toast);

        // 添加动画
        setTimeout(() => {
            toast.classList.add('show');
        }, 10);

        // 3秒后移除
        setTimeout(() => {
            toast.classList.remove('show');
            setTimeout(() => {
                document.body.removeChild(toast);
            }, 300);
        }, 3000);
    }
</script>
</body>
</html>